package com.latvia.managers;

import java.util.ArrayList;

import com.latvia.cookingapp.R;
import com.latvia.model.Recipe;

public class DataManager {
	
	private static DataManager instance;
	private ArrayList<Recipe> recipes;
	
	public static DataManager getInstance() {
		if (instance == null) {
			instance = new DataManager();
		}
		return instance;
	}
	
	public ArrayList<Recipe> getFavouriteRecipes() {
		ArrayList<Recipe> favouriteRecipes = new ArrayList<Recipe>();
		 favouriteRecipes.add(new Recipe("Pancakes", "The most delicious pancakes evaarrr!@!", 100, R.drawable.p4, 1, true, 1));
		 favouriteRecipes.add(new Recipe("Burger", "Burger from McDonalds", 50, R.drawable.p3, 1, false, 1));
		 favouriteRecipes.add(new Recipe("Burger2", "This burger is from Hesburger", 50, R.drawable.p2, 1, true, 2));
		 favouriteRecipes.add(new Recipe("Cake","Chocolate cake", 70, R.drawable.p1, 1, true, 3));
		 
		 return favouriteRecipes;
	}

	public ArrayList<Recipe> getRecipes() {
		return recipes;
	}

	public void setRecipes(ArrayList<Recipe> recipes) {
		this.recipes = recipes;
	}
	
	
	public ArrayList<Recipe> recipesByComplexity(int complexity) {
		ArrayList<Recipe> recipesSorted = new ArrayList<Recipe>();
		for (Recipe recipe : recipes) {
			if (recipe.getCategoryId() == complexity) {
				recipesSorted.add(recipe);
			}
		}
		
		return recipesSorted;
		
	}
	
	
}
